<%@page language="java" pageEncoding="UTF-8"%>
<%@taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%@taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<%@taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>
<%@taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<%@taglib uri="http://java.sun.com/jstl/fmt" prefix="fmt"%>
<%@taglib prefix="sec" uri="http://www.springframework.org/security/tags"%>
<html>
	<head>
		<TITLE>留言板--留言列表</TITLE>
		<jsp:include page="../cssjsInList.jsp" flush="true"/>
	</head>
	<body>
		<div id="content">
			<TABLE class=border cellSpacing=1 cellPadding=2 width="100%" align=center border=0>
				<TBODY>
					<TR class=topbg>
						<TD align=middle colSpan=2 height=22>
							<STRONG>留言板管理</STRONG>
						</TD>
					</TR>
					<TR class=topbg>
						<TD>
							<STRONG> 
								<a href="<%=request.getContextPath()%>/feedbackManage.do?method=feedbacklist">留言板管理首页</a>
							</STRONG>
						</TD>
					</TR>
					<TR>
						<TD>
							<br>
							<form name=form
								action="<%=request.getContextPath()%>/feedbackManage.do?method=feedbacklist" method=post>
								<TABLE width="100%" align=center border=0>
									<TR>
										<TD><input onclick="submit();" type="radio"  <c:if test="${radiooption=='all'}" > checked</c:if> value="all" name="radiooption"  CHECKED>
											ALL&nbsp;&nbsp;&nbsp;
											<INPUT onclick=submit(); type=radio  id="weishenhe" value=weishenhe	name=radiooption <c:if test="${radiooption=='weishenhe'}" > checked</c:if>>
											未审核&nbsp;&nbsp;&nbsp;
											<INPUT onclick=submit(); type=radio  id="yitongguo" value=yitongguo	name=radiooption <c:if test="${radiooption=='yitongguo'}" > checked</c:if>>
											已通过&nbsp;&nbsp;&nbsp;&nbsp;
											<INPUT onclick=submit(); type=radio  id="weitongguo" value=weitongguo name=radiooption <c:if test="${radiooption=='weitongguo'}" > checked</c:if>>
											未通过&nbsp;&nbsp;&nbsp;&nbsp;
										</TD>
									</TR>
								</TABLE>
							</form>
						</TD>
					</TR>
				</TBODY>
			</TABLE>

			<div id="content">
				<table border="0" width="100%" align="center">
					<tr>
						<td align="center">
							<form action="<%=request.getContextPath()%>/feedbackManage.do?method=feedbacklist&Action=Manage" method="post">
								<SELECT size=1 name=keywordType>
									<OPTION value=comments selected>
										留言标题
									</OPTION>
									<OPTION value=admin>
										留言者
									</OPTION>
								</SELECT>
								<input name="keyword" type="text" size="40" maxlength="40" />
								<input name="button" type="submit" value="查找" />
							</form>
						</td>
					</tr>
				</table>
				<form name="form_1" method="post">
					<table width="100%" border="0" cellspacing="0" cellpadding="0" class="data">
						<tr>
							<sec:authorize ifAllGranted="ROLE_FEEDBACK_SHENHE">
								<th colspan="2" align="center" nowrap="nowrap">
							</sec:authorize>
							<sec:authorize ifNotGranted="ROLE_FEEDBACK_SHENHE">
								<th colspan="1" align="center" nowrap="nowrap">
							</sec:authorize>						
								<div align="center">ID</div>
								</th>
							<th width="10%" align="center" nowrap="nowrap">已回复</th>
							<th width="15%" align="center" nowrap="nowrap">留言人</th>
							<th colspan="4" align="center" nowrap="nowrap">留言内容</th>
							<th width="10%" align="center" nowrap="nowrap">留言时间</th>
							<th width="15%" align="center" nowrap="nowrap">IP</th>
							<th width="5%" align="center" nowrap="nowrap">审核状态</th>
							<th width="10%" align="center" nowrap="nowrap">操作</th>
						</tr>
						<c:forEach items="${feebacklist}" var="feedback">
							<c:if test="${feedback.feedbackID%2==1}">
								<c:set var="rowtype" value="odd" />
							</c:if>
							<c:if test="${feedback.feedbackID%2==0}">
								<c:set var="rowtype" value="even" />
							</c:if>
							<tr class="${rowtype}" onMouseOver="this.className = 'row_over';" onMouseOut="this.className = '${rowtype}';" >
								<sec:authorize ifAllGranted="ROLE_FEEDBACK_SHENHE">
								<td width="4%" align="center" nowrap="nowrap">
									<input type="checkbox" name="checkbox_${feedback.feedbackID}"
										id="checkbox_row_${feedback.feedbackID}"
										value="${feedback.feedbackID}" />				
								</td>
								</sec:authorize>
								<td width="6%" align="center" nowrap="nowrap">
									${feedback.feedbackID}
								</td>
								<td align="center" nowrap="nowrap">
									<font color="red"> 
										<c:choose>
											<c:when test="${feedback.replydate!=null}">
												<img src="./jsp/manage/images/ok.gif" width="13" height="13">
											</c:when>
											<c:when test="${feedback.replydate==null}">
											  <img src="./jsp/manage/images/reply.gif" width="16" height="16">
											 </c:when>
										</c:choose> 
									</font>
								</td>
								<td align="right" nowrap="nowrap"  >
									<div align="center">
										${feedback.name}
									</div>
								</td>
								<td colspan="4" align="left"  >
									 ${feedback.comments}
								</td>
								<td align="center" nowrap="nowrap">
									${feedback.commentsdate}
								</td>
								<td align="right" nowrap="nowrap">
									<div align="center">
										${feedback.ip}
									</div>
								</td>
								<td align="center" nowrap="nowrap">
									<font color="red">
										<c:choose>
											<c:when test="${feedback.aproveState==0}">
												<img src="./jsp/manage/images/aprove.gif" width="13" height="13">
											</c:when>
											<c:when test="${feedback.aproveState==1}">
												<img src="./jsp/manage/images/ok.gif" width="13" height="13">
											</c:when>
											<c:otherwise>
												<img src="./jsp/manage/images/not.gif" width="13" height="13">
											</c:otherwise>
										</c:choose>
									</font>
								</td>
								<td align="center" nowrap="nowrap">
									<a href="<%=request.getContextPath()%>/feedbackManage.do?method=reply&feedbackID=${feedback.feedbackID}">查看详情并回复</a> 
									|
									<a href="<%=request.getContextPath()%>/feedbackManage.do?method=delete&feedbackID=${feedback.feedbackID}"
										onClick="return confirm('您确定要删除 ${feedback.name} 的留言吗？');">删除</a>
								</td>
                          </tr>
						</c:forEach>
						<sec:authorize ifAllGranted="ROLE_FEEDBACK_SHENHE">
						<tr>
							<td colspan="2" align="center" bgcolor="#FCFCFC">&nbsp;</td>
							<td colspan="2" align="center" bgcolor="#FCFCFC">
								<input name="chkall" onClick="checkall(this.form)" type="checkbox">
								全选	
							</td>
							<td width="6%" align="center" bgcolor="#FCFCFC">
								<input type="button" name="approved" id="approved1" value="审核通过"
									onClick="ymPrompt.confirmInfo('确认审核吗？',null,null,null,handler)" />
							</td>
							<td width="1%" align="center" bgcolor="#FCFCFC">
								&nbsp;
							</td>
							<td width="5%" align="center" bgcolor="#FCFCFC">
								<div align="left">
									<input type="button" name="notapproved" id="approved2"
										value="不通过" onClick="ymPrompt.confirmInfo('确认驳回吗？',null,null,null,handler2)" />
								</div>
							</td>
							<td width="1%" align="center" bgcolor="#FCFCFC">
								&nbsp;
							</td>
							<td width="5%" align="center" bgcolor="#FCFCFC">
								<div align="left">
									<input type="button" name="delete" id="delelte1"
										value="删除" onClick="ymPrompt.confirmInfo('确认删除吗？',null,null,null,handler3)" />
								</div>
							</td>
						</tr>
						</sec:authorize>
					<tr>
						<td colspan="15" align="center" bgcolor="#FCFCFC">
							<jsp:include page="../page.jsp" flush="true"/>
						</td>
					</tr>
				</table>
				</form>	
			</div>
	</body>
</html>
<script type="text/javascript">
function handler(tp){
	if(tp=='ok'){
		document.form_1.action="<%=request.getContextPath()%>/feedbackManage.do?method=feedbackApprove&approveState=1"
		document.form_1.submit();
	}
	if (tp == 'cancel'){}
	if (tp == 'close'){}
}
function handler2(tp) {
	if (tp == 'ok') {
		document.form_1.action="<%=request.getContextPath()%>/feedbackManage.do?method=feedbackApprove&approveState=2";
		document.form_1.submit();
	}
	if (tp == 'cancel'){}
	if (tp == 'close'){}
}
function handler3(tp) {
	if (tp == 'ok') {
		document.form_1.action="<%=request.getContextPath()%>/feedbackManage.do?method=deleteAll";
		document.form_1.submit();
	}
	if (tp == 'cancel'){}
	if (tp == 'close'){}
}
</script>